package ru.cargobroker.maip.contracts.domain;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Version;

import ru.cargobroker.maip.base.db.DbConstants;
import ru.cargobroker.maip.base.domain.BaseEntity;
import javax.persistence.Inheritance;
import static javax.persistence.InheritanceType.SINGLE_TABLE;

/**
 * 
 * TODO: rule of numbering policy, ex: code-channel-policyNumber-region
 * 
 * @author M.Frendiy
 * @since 0.0.1
 */
@Entity
public class Policy extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -537561033948135449L;

	/**
	 * Enable the JPA-managed optimistic locking transaction strategy (using versions)
	 */
	@Version
	private int version;

	/**
	 * Number of document. Ex: 321123, A123, FG-345-2001/1
	 */
	@Column(name="POLICY_NUMBER", nullable=false, length=DbConstants.DOCUMENT_NUMBER_LEN)
	private String policyNumber;

	public String getPolicyNumber() {
		return policyNumber;
	} 

	public void setPolicyNumber(String policyNumber) {
		this.policyNumber = policyNumber;
	}
	
	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}
}
